import axios from 'axios';
import qs from 'query-string';

export interface Record {
  id?: number;
  createtime?: number;
  updatetime?: number;
}

export interface Params extends Partial<Record> {
  current: number;
  pageSize: number;
}

export interface Res {
  list: Record[];
  total: number;
}

export function getData(params: Params) {
  return axios.get<Res>('/pc/score_order/list', {
    params,
    paramsSerializer: (obj) => {
      return qs.stringify(obj);
    },
  });
}
export function send(data: any) {
  return axios({
    url: '/pc/score_order/send',
    method: 'post',
    data,
  });
}
export function refund(data: any) {
  return axios({
    url: '/pc/score_order/refund',
    method: 'post',
    data,
  });
}
export function refund_reject(data: any) {
  return axios({
    url: '/pc/score_order/refund_reject',
    method: 'post',
    data,
  });
}
export function savetData(data: Record) {
  return axios({
    url: '/pc/score_order/save',
    method: 'post',
    data,
  });
}

export function delData(ids: string | number) {
  return axios({
    url: '/pc/score_order/del',
    method: 'delete',
    data: { ids },
  });
}

export function auditsData(data: any) {
  return axios({
    url: '/pc/student/audits',
    method: 'post',
    data,
  });
}
